package com.parking.mgr.common.exception.enums;


import com.parking.mgr.common.annotion.ExpEnumType;
import com.parking.mgr.common.constant.ExpEnumConstant;
import com.parking.mgr.common.factory.ExpEnumCodeFactory;

/**
 * @ClassName CommonExceptionEnum
 * @Description TODO
 * @author: zhijianpu
 * @Date: 2023/7/3
 */
@ExpEnumType(module = ExpEnumConstant.CORE_MODULE_EXP_CODE, kind = ExpEnumConstant.AUTH_EXCEPTION_ENUM)
public enum CommonExceptionEnum implements IBaseExceptionEnum {

    CAN_NOT_MOVE_CURRENT_NODE(1, "不能将节点移动到本目录及子目录下"),

    I18N_MESSAGE_CAN_NOT_MOVE_CURRENT_NODE(1, "i18n_message_can_not_move_current_node"),

    DATA_NOT_EXIST(2, "数据不存在"),

    I18N_MESSAGE_DATA_NOT_EXIST(2, "i18n_message_data_not_exist"),

    DATA_REPEAT(3, "数据重复"),

    I18N_MESSAGE_DATA_REPEAT(3, "i18n_message_data_repeat"),

    PARENT_ID_CAN_NOT_EQ_CHILD_ID(4, "父节点不能为本节点的子节点"),
    I18N_MESSAGE_PARENT_ID_CAN_NOT_EQ_CHILD_ID(4, "i18n_message_pid_cant_eq_child_id"),

    /**
     * 父级菜单不能为当前节点，请重新选择父级菜单
     */
    PARENT_ID_CAN_NOT_EQ_CURRENT_ID(5, "父节点不能为当前节点"),
    I18N_MESSAGE_PARENT_ID_CAN_NOT_EQ_CURRENT_ID(5, "i18n_message_parent_id_can_not_eq_current_id"),

    MENU_ROUTER_EMPTY(6, "路由地址为空"),
    I18N_MESSAGE_MENU_ROUTER_EMPTY(6, "i18n_message_menu_router_empty"),

    OPERATION_FAILURE(7, "操作失败"),
    I18N_MESSAGE_OPERATION_FAILURE(7, "i18n_message_operation_failure"),

    VALIDATED_DATA_EXCEPTION(8, "数据校验异常"),
    I18N_MESSAGE_VALIDATED_DATA_EXCEPTION(8,"i18n_message_validated_data_exception")
    ;

    private final Integer code;

    private final String message;

    CommonExceptionEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public Integer getCode() {
        return ExpEnumCodeFactory.getExpEnumCode(this.getClass(), code);
    }

    @Override
    public String getMessage() {
        return message;
    }
}
